﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameBase;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using GameBase.Form.Control;

namespace GalaxyPresident
{
    public class Capital : OwnEntity
    {
        private static Texture2D texture = Constant.content.Load<Texture2D>(@"Resources/capital");
        private static Texture2D texture_s = Constant.content.Load<Texture2D>(@"Resources/capital_s");

        private Team _willBeTeamOwner;

        private Capital(Planet planet)
            : base(planet)        
        {
            internalInit(planet);
        }

        public Capital(Planet planet, Team teamOwner)
            : base(planet)
        {
            //planet.TeamOwner = teamOwner;
            _willBeTeamOwner = teamOwner;
            internalInit(planet);
        }

        private void internalInit(Planet planet)
        {
            sprite_s = new Sprite(texture_s, 1, 3,
                new List<int> { 0, 1, 2, 1 }, 150);
            sprite = new Sprite(texture, 1, 3,
                new List<int> { 0, 1, 2, 1 }, 150);

            initSprites(planet);
        }

        public void setCompletelyTeamOwner()
        {
            PlanetOwner.TeamOwner = _willBeTeamOwner;
        }

        public override string getObjectName()
        {
            return "Capital";
        }
        protected override void InitAvailableTasks()
        {
            base.InitAvailableTasks();
            /*CreateUnitTask task = new CreateUnitTask(null, 0);
            task.Button = new MyNumberBox(Vector2.Zero);
            availableTasks.Add(task);*/
        }

        protected override void updateSpriteSColor()
        {
            sprite_s.Color = _willBeTeamOwner.TeamColor;
        }

        protected override void initInfo()
        {
            meterialCost = 2500;
            moneyCost = 3000;
            energyCost = 1200;

            _healthPoint = 10000;
            _defense = 0.3f;
        }
    }
}
